import time
import unittest
from selenium import webdriver
from selenium.webdriver.common.by import By

from Page1 import Page1
from Page2 import Page2


class TestCase(unittest.TestCase):

    def setUp(self):
        self.driver=webdriver.Edge()
        self.driver.maximize_window()
        self.driver.implicitly_wait(5)

    def tearDown(self):
        time.sleep(10)
        self.driver.quit()

    def test_jiuxian_01(self):
        po=Page1(self.driver)
        po.open_url('https://www.jiuxian.com/')
        po.login()
        dy1=self.driver.find_element(By.XPATH,'//*[@id="loginform"]/div/div/div/div/div[1]/div[1]/a[1]').text
        print(dy1)
        self.assertEqual('帐号登录',dy1)
        po.username()
        po.password()
        time.sleep(10)
        po.loginbtn()
        po.accept()
        dy2=self.driver.find_element(By.XPATH,'/html/body/div[2]/div/div[1]/div/p/span').text
        print(dy2)
        self.assertEqual('jxw627748426',dy2)

    def test_jiuxian_02(self):
        po1=Page2(self.driver)
        po1.jiuxian_luoji2()
if __name__ == '__main__':
    unittest.main()